package com.woyou.model.rpc;

import retrofit.RetrofitError;
import retrofit.http.Field;
import retrofit.http.FormUrlEncoded;
import retrofit.http.POST;

import com.woyou.bean.CodeListResult;
import com.woyou.bean.CodeResult;
import com.woyou.bean.Coupon;
import com.woyou.bean.DeliverTime;
import com.woyou.bean.OrderDetail;
import com.woyou.bean.Result;
import com.woyou.bean.rpc.QueryActUrlRes;
import com.woyou.bean.rpc.QueryOrderNoRes;
import com.woyou.bean.rpc.SendOrderRes;

@SuppressWarnings("rawtypes")
public interface OrderService {

	/**
	 * 发送订单
	 * 
	 * @param params
	 *            请求bean的json字符串
	 * @param isEncrypted
	 *            是否加密
	 * @param timeStamp
	 *            时间戳
	 * @param randomNum
	 *            6位随机数
	 * @param sign
	 *            加密后的字符串 算法:sign =
	 *            MD5(Parameter+IsEncrypted+TimeStamp+RandomNum+MD5(Key))
	 * @return
	 * @throws RetrofitError
	 */
	@FormUrlEncoded
	@POST("/v2_3sendOrder")
	public Result<SendOrderRes> v2_3sendOrder(@Field("params") String params,
			@Field("isEncrypted") String isEncrypted,
			@Field("timeStamp") String timeStamp,
			@Field("randomNum") String randomNum, @Field("sign") String sign)
			throws RetrofitError;

	/**
	 * 查询订单状态
	 * 
	 * @param params
	 * @param isEncrypted
	 * @param timeStamp
	 * @param randomNum
	 * @param sign
	 * @return
	 * @throws RetrofitError
	 */
	@FormUrlEncoded
	@POST("/queryOrderStatus")
	public CodeResult<QueryOrderNoRes> queryOrderStatus(
			@Field("params") String params,
			@Field("isEncrypted") String isEncrypted,
			@Field("timeStamp") String timeStamp,
			@Field("randomNum") String randomNum, @Field("sign") String sign)
			throws RetrofitError;

	/**
	 * 获取我的优惠券
	 * 
	 * @param params
	 * @param isEncrypted
	 * @param timeStamp
	 * @param randomNum
	 * @param sign
	 * @return
	 * @throws RetrofitError
	 */
	@FormUrlEncoded
	@POST("/queryCoupons")
	public CodeListResult<Coupon> queryCoupons(@Field("params") String params,
			@Field("isEncrypted") String isEncrypted,
			@Field("timeStamp") String timeStamp,
			@Field("randomNum") String randomNum, @Field("sign") String sign)
			throws RetrofitError;

	/**
	 * 获取营业时段
	 * 
	 * @param params
	 * @param isEncrypted
	 * @param timeStamp
	 * @param randomNum
	 * @param sign
	 * @return
	 * @throws RetrofitError
	 */
	@FormUrlEncoded
	@POST("/queryTime")
	public CodeListResult<DeliverTime> queryTime(
			@Field("params") String params,
			@Field("isEncrypted") String isEncrypted,
			@Field("timeStamp") String timeStamp,
			@Field("randomNum") String randomNum, @Field("sign") String sign)
			throws RetrofitError;

	/**
	 * 2.3 获取订单详情（http://xxxx/ v2_3queryOrderDetail）
	 * 
	 * @param params
	 * @param isEncrypted
	 * @param timeStamp
	 * @param randomNum
	 * @param sign
	 * @return
	 * @throws RetrofitError
	 */
	@FormUrlEncoded
	@POST("/v2_3queryOrderDetail")
	public Result<OrderDetail> v2_3queryOrderDetail(
			@Field("params") String params,
			@Field("isEncrypted") String isEncrypted,
			@Field("timeStamp") String timeStamp,
			@Field("randomNum") String randomNum, @Field("sign") String sign)
			throws RetrofitError;

	/**
	 * 2.23 催单（http://xxxx/reminder）
	 * 
	 * @param params
	 * @param isEncrypted
	 * @param timeStamp
	 * @param randomNum
	 * @param sign
	 * @return
	 * @throws RetrofitError
	 */
	@FormUrlEncoded
	@POST("/reminder")
	public CodeResult reminder(@Field("params") String params,
			@Field("isEncrypted") String isEncrypted,
			@Field("timeStamp") String timeStamp,
			@Field("randomNum") String randomNum, @Field("sign") String sign)
			throws RetrofitError;

	/**
	 * 2.22 确认收货（http://xxxx/orderConfirm）
	 * 
	 * @param params
	 * @param isEncrypted
	 * @param timeStamp
	 * @param randomNum
	 * @param sign
	 * @return
	 * @throws RetrofitError
	 */
	@FormUrlEncoded
	@POST("/orderConfirm")
	public CodeResult orderConfirm(@Field("params") String params,
			@Field("isEncrypted") String isEncrypted,
			@Field("timeStamp") String timeStamp,
			@Field("randomNum") String randomNum, @Field("sign") String sign)
			throws RetrofitError;

	/**
	 * 2.18 订单评论（http://xxxx/orderComments）
	 * 
	 * @param params
	 * @param isEncrypted
	 * @param timeStamp
	 * @param randomNum
	 * @param sign
	 * @return
	 * @throws RetrofitError
	 */
	@FormUrlEncoded
	@POST("/orderComments")
	public CodeResult orderComments(@Field("params") String params,
			@Field("isEncrypted") String isEncrypted,
			@Field("timeStamp") String timeStamp,
			@Field("randomNum") String randomNum, @Field("sign") String sign)
			throws RetrofitError;

	/**
	 * 2.5 取消订单（http://xxxx/ v2_1cancelOrder）
	 * 
	 * 2.1新接口
	 * 
	 * @param params
	 * @param isEncrypted
	 * @param timeStamp
	 * @param randomNum
	 * @param sign
	 * @return
	 * @throws RetrofitError
	 */
	@FormUrlEncoded
	@POST("/v2_1cancelOrder")
	public Result v2_1cancelOrder(@Field("params") String params,
			@Field("isEncrypted") String isEncrypted,
			@Field("timeStamp") String timeStamp,
			@Field("randomNum") String randomNum, @Field("sign") String sign)
			throws RetrofitError;

	/**
	 * 2.27 根据订单查询市场活动（http://xxxx/queryActByOrder）
	 * 
	 * @param params
	 * @param isEncrypted
	 * @param timeStamp
	 * @param randomNum
	 * @param sign
	 * @return
	 * @throws RetrofitError
	 */
	@FormUrlEncoded
	@POST("/queryActByOrder")
	public CodeResult<QueryActUrlRes> queryActByOrder(
			@Field("params") String params,
			@Field("isEncrypted") String isEncrypted,
			@Field("timeStamp") String timeStamp,
			@Field("randomNum") String randomNum, @Field("sign") String sign)
			throws RetrofitError;

	/**
	 * TODO 重试推送订单（http://xxxx/v2_3RetryPushOrder）(在线支付重新推送订单)
	 * 
	 * @param params
	 * @param isEncrypted
	 * @param timeStamp
	 * @param randomNum
	 * @param sign
	 * @return CodeResult
	 */
	@FormUrlEncoded
	@POST("/v2_3RetryPushOrder")
	public CodeResult onlinePayRetryPushOrder(@Field("params") String params,
			@Field("isEncrypted") String isEncrypted,
			@Field("timeStamp") String timeStamp,
			@Field("randomNum") String randomNum, @Field("sign") String sign);

	/**
	 * 2.3根据订单号查询后台是否已确认在线支付成功（http://xxxx/ v2_3queryPayResult） TODO
	 * 
	 * @param params
	 * @param isEncrypted
	 * @param timeStamp
	 * @param randomNum
	 * @param sign
	 * @return CodeResult
	 */
	@FormUrlEncoded
	@POST("/v2_3queryPayResult")
	public CodeResult queryPayResult(@Field("params") String params,
			@Field("isEncrypted") String isEncrypted,
			@Field("timeStamp") String timeStamp,
			@Field("randomNum") String randomNum, @Field("sign") String sign);

	/**
	 * TODO 2.5退款接口（http://xxxx/v2_3Refund）
	 * 
	 * @param params
	 * @param isEncrypted
	 * @param timeStamp
	 * @param randomNum
	 * @param sign
	 * @return CodeResult
	 */
	@FormUrlEncoded
	@POST("/v2_3Refund")
	public CodeResult refund(@Field("params") String params,
			@Field("isEncrypted") String isEncrypted,
			@Field("timeStamp") String timeStamp,
			@Field("randomNum") String randomNum, @Field("sign") String sign);

}
